package com.etaoking.commons;

import java.util.List;

import models.Menu;
import play.Logger;
import play.cache.Cache;

public class MenuUtils {
	
	private MenuUtils(){}
	
	private static MenuUtils instance = new MenuUtils();
	
	public static MenuUtils getInstance(){
		return instance;
	}
	
	public List<Menu> getMenus(){
		List<Menu> menus = Cache.get("menus", List.class);
		if(menus==null){
			Logger.info("查询菜单!", "");
			menus = Menu.findAll();
			Cache.set("menus", menus);
		}
		return menus;
	}
}
